<template>
  <div>
      <el-table
          :data="capital"
          border
          :row-class-name="tableRowClassName"
          style="width: 100%"
          >
          <el-table-column v-for="(item,index) in capitalTit" :key="index"
            :prop="item.prop"
            :label="item.label"
            :min-width="item.width">
            <!-- <template slot-scope="scope">
              <span style="color: red;" v-if="item.label === '过期时间' && scope.row['gqbs'] === 1">
                {{scope.row[item.prop]}}
              </span>
              <span v-else>
                {{scope.row[item.prop]}}
              </span>
            </template> -->
          </el-table-column>
        </el-table>
        <!-- <div style="margin: 30px 0;">
          <el-pagination
          @current-change="handleCurrentChange"
          :page-size="pageSize"
          layout="prev, pager, next, jumper"
          :total="total">
          </el-pagination>
        </div> -->
        <div style="margin: 30px 0;">
          <el-pagination
          @current-change="handleCurrentChange"
          :page-size="pageSize"
          layout="prev, pager, next, jumper"
          :total="total">
          </el-pagination>
        </div>
  </div>
</template>
<script>
export default {
  data() {
    console.log('熟悉2223113')
    return {
      id:this.$route.params.id,
      capitalTit:[{
          prop:'fuid',
          label:'用户id',
          width: '100'
        },{
          prop:'ffxje',
          label:'返现金额',
          width: '100'
        },{
          prop:'ftze',
          label:'要求投资额',
          width: '120'
        },{
          prop:'fqx',
          label:'投资期限',
          width: '100'
        },{
          prop:'tdate',
          label:'领取时间',
          width: '200'
        },{
          prop:'tgqsj',
          label:'过期时间',
          width: '200'
        },{
          prop:'tjhsj',
          label:'激活时间',
          width: '200'
        },{
          prop:'tjhsj1',
          label:'是否激活',
          width: '100'
        },{
          prop:'csm',
          label:'类型说明',
          width: '180'
        },{
          prop:'flx',
          label:'类型ID',
          width: '100'
        },{
          prop:'ftzjlid',
          label:'投资记录ID',
          width: '100'
        }
      ],
      capital:[],
      total: 0,
      pageSize: 10,
    }
  },
  methods: {
    
    handleCurrentChange(val) {
       this.getTableDate(val)
    },
    tableRowClassName(row, index) {
      if(row.gqbs===1){
         return 'info-row';
       }
    },
    getTableDate (page) {
      this.$get(this,{api:'/member/getXjq.do',data: {
        fUid:this.id,
        
        pageSize: this.pageSize,
        page
      }
      }).then(({data})=>{
        console.log(data.content.data)
        if (data.state === 0) {
          if (page == 1) {
            this.total = data.content.num;
          }
          data.content.data.forEach(function(o) {
            o.tjhsj1 = o.tjhsj ? '已激活' : '未激活'
          }, this);
          this.capital = data.content.data;
        } else {
          this.$toast({
            message: data.message
          })
        }
      })

    }
  },
  mounted () {
    this.getTableDate(1);
  }
}
</script>
<style>
.el-table .info-row td:nth-child(6) .cell{
    color:red !important;
  }

</style>

